<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Netty核心组件深度解析</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        
        .content-card {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            transition: all 0.3s ease;
        }
        
        .content-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
        }
        
        .section-title {
            position: relative;
            padding-left: 20px;
        }
        
        .section-title::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 4px;
            height: 24px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 2px;
        }
        
        .code-block {
            background: #1e1e1e;
            color: #d4d4d4;
            border-radius: 8px;
            padding: 20px;
            overflow-x: auto;
            font-family: 'Consolas', 'Monaco', monospace;
            font-size: 14px;
            line-height: 1.6;
            margin: 20px 0;
        }
        
        .feature-icon {
            width: 60px;
            height: 60px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 12px;
            color: white;
            font-size: 24px;
            margin-bottom: 16px;
        }
        
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 30px 0;
        }
        
        .highlight-box {
            background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            color: white;
            padding: 20px;
            border-radius: 12px;
            margin: 20px 0;
        }
        
        .component-card {
            background: white;
            border-radius: 16px;
            padding: 30px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
            transition: all 0.3s ease;
        }
        
        .component-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
        }
        
        .timeline-item {
            position: relative;
            padding-left: 40px;
            margin-bottom: 30px;
        }
        
        .timeline-item::before {
            content: '';
            position: absolute;
            left: 10px;
            top: 8px;
            width: 12px;
            height: 12px;
            background: #667eea;
            border-radius: 50%;
        }
        
        .timeline-item::after {
            content: '';
            position: absolute;
            left: 15px;
            top: 20px;
            width: 2px;
            height: calc(100% + 10px);
            background: #e0e0e0;
        }
        
        .timeline-item:last-child::after {
            display: none;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <div class="hero-gradient text-white py-20">
        <div class="container mx-auto px-6">
            <div class="text-center">
                <h1 class="text-5xl font-bold mb-6 animate-pulse">Netty核心组件深度解析</h1>
                <p class="text-xl opacity-90 max-w-3xl mx-auto leading-relaxed">
                    探索高性能网络框架的精髓，掌握异步事件驱动的艺术
                </p>
                <div class="mt-10 flex justify-center space-x-6">
                    <div class="text-center">
                        <i class="fas fa-network-wired text-4xl mb-2"></i>
                        <p class="text-sm">高性能网络</p>
                    </div>
                    <div class="text-center">
                        <i class="fas fa-bolt text-4xl mb-2"></i>
                        <p class="text-sm">异步非阻塞</p>
                    </div>
                    <div class="text-center">
                        <i class="fas fa-puzzle-piece text-4xl mb-2"></i>
                        <p class="text-sm">模块化设计</p>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Introduction -->
    <div class="container mx-auto px-6 py-12">
        <div class="content-card rounded-2xl shadow-xl p-10">
            <p class="text-lg leading-relaxed text-gray-700 indent-8">
                Netty已成为一个广泛应用的框架，以其高效的网络处理能力和灵活的设计而著称。我常常被问及如何在复杂的网络应用中确保高吞吐量和低延迟。Netty通过其一系列核心组件，为我们提供了一种优雅且高效的解决方案。
            </p>
            <p class="text-lg leading-relaxed text-gray-700 mt-6 indent-8">
                Netty是一个基于Java NIO（非阻塞IO）构建的异步事件驱动网络应用框架。它的设计目标是为开发者提供一种简便的方式来构建可扩展的高性能网络服务器和客户端。
            </p>
        </div>
    </div>

    <!-- Core Components Overview -->
    <div class="container mx-auto px-6 py-12">
        <h2 class="text-3xl font-bold mb-8 text-center text-gray-800">核心组件架构图</h2>
        <div class="mermaid">
            graph TB
                A[Netty Application] --> B[Bootstrap/ServerBootstrap]
                B --> C[EventLoopGroup]
                C --> D[EventLoop]
                D --> E[Channel]
                E --> F[ChannelPipeline]
                F --> G[ChannelHandler]
                E --> H[ByteBuf]
                E --> I[ChannelFuture]
                
                style A fill:#667eea,stroke:#fff,stroke-width:2px,color:#fff
                style B fill:#764ba2,stroke:#fff,stroke-width:2px,color:#fff
                style C fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
                style D fill:#f5576c,stroke:#fff,stroke-width:2px,color:#fff
                style E fill:#4facfe,stroke:#fff,stroke-width:2px,color:#fff
                style F fill:#00f2fe,stroke:#fff,stroke-width:2px,color:#fff
                style G fill:#fa709a,stroke:#fff,stroke-width:2px,color:#fff
                style H fill:#fee140,stroke:#fff,stroke-width:2px,color:#fff
                style I fill:#30cfd0,stroke:#fff,stroke-width:2px,color:#fff
        </div>
    </div>

    <!-- Main Features -->
    <div class="container mx-auto px-6 py-12">
        <h2 class="text-4xl font-bold mb-12 text-center text-gray-800">
            <i class="fas fa-star text-purple-600 mr-3"></i>Netty的主要特性
        </h2>
        
        <div class="grid md:grid-cols-2 lg:grid-cols-3 gap-8">
            <!-- Feature 1 -->
            <div class="component-card">
                <div class="feature-icon">
                    <i class="fas fa-rocket"></i>
                </div>
                <h3 class="text-xl font-bold mb-4 text-gray-800">异步非阻塞 I/O</h3>
                <p class="text-gray-600 leading-relaxed">
                    基于 Java NIO 的异步非阻塞模型，通过少量线程处理大量并发连接，避免线程上下文切换的开销。
                </p>
            </div>
            
            <!-- Feature 2 -->
            <div class="component-card">
                <div class="feature-icon">
                    <i class="fas fa-plug"></i>
                </div>
                <h3 class="text-xl font-bold mb-4 text-gray-800">灵活的扩展能力</h3>
                <p class="text-gray-600 leading-relaxed">
                    高度可配置和可扩展的设计，通过 ChannelPipeline 和 ChannelHandler 轻松实现自定义功能。
                </p>
            </div>
            
            <!-- Feature 3 -->
            <div class="component-card">
                <div class="feature-icon">
                    <i class="fas fa-tachometer-alt"></i>
                </div>
                <h3 class="text-xl font-bold mb-4 text-gray-800">高性能</h3>
                <p class="text-gray-600 leading-relaxed">
                    零拷贝技术、内存池化机制、线程模型优化，充分利用多核 CPU 资源，实现高吞吐量低延迟。
                </p>
            </div>
            
            <!-- Feature 4 -->
            <div class="component-card">
                <div class="feature-icon">
                    <i class="fas fa-shield-alt"></i>
                </div>
                <h3 class="text-xl font-bold mb-4 text-gray-800">安全性</h3>
                <p class="text-gray-600 leading-relaxed">
                    内置 SSL/TLS 支持，提供强大的加密通信能力，确保数据传输的保密性和完整性。
                </p>
            </div>
            
            <!-- Feature 5 -->
            <div class="component-card">
                <div class="feature-icon">
                    <i class="fas fa-globe"></i>
                </div>
                <h3 class="text-xl font-bold mb-4 text-gray-800">跨平台</h3>
                <p class="text-gray-600 leading-relaxed">
                    基于 Java 开发，可在 Linux、Windows、MacOS 等多种操作系统上无缝运行。
                </p>
            </div>
            
            <!-- Feature 6 -->
            <div class="component-card">
                <div class="feature-icon">
                    <i class="fas fa-users"></i>
                </div>
                <h3 class="text-xl font-bold mb-4 text-gray-800">丰富的生态</h3>
                <p class="text-gray-600 leading-relaxed">
                    活跃的开源社区，大量基于 Netty 的项目如 Dubbo、gRPC 等，极大拓展了应用场景。
                </p>
            </div>
        </div>
    </div>

    <!-- Core Components Detail -->
    <div class="container mx-auto px-6 py-12">
        <h2 class="text-4xl font-bold mb-12 text-center text-gray-800">
            <i class="fas fa-cube text-purple-600 mr-3"></i>核心组件详解
        </h2>

        <!-- Channel -->
        <div class="content-card rounded-2xl shadow-xl p-10 mb-8">
            <h3 class="section-title text-2xl font-bold mb-6 text-gray-800">Channel（通道）</h3>
            <p class="text-gray-700 leading-relaxed mb-6 indent-8">
                在Netty中，Channel是一个核心组件，负责抽象底层网络通信的细节，使得开发者可以专注于业务逻辑而不必深入了解复杂的I/O操作。
            </p>
            
            <div class="grid md:grid-cols-2 gap-6 mb-8">
                <div class="bg-purple-50 p-6 rounded-lg">
                    <h4 class="font-bold text-purple-800 mb-3">
                        <i class="fas fa-network-wired mr-2"></i>主要类型
                    </h4>
                    <ul class="space-y-2 text-gray-700">
                        <li><i class="fas fa-chevron-right text-purple-600 mr-2"></i>NioSocketChannel - TCP客户端/服务端</li>
                        <li><i class="fas fa-chevron-right text-purple-600 mr-2"></i>NioServerSocketChannel - TCP服务端监听</li>
                        <li><i class="fas fa-chevron-right text-purple-600 mr-2"></i>NioDatagramChannel - UDP通信</li>
                        <li><i class="fas fa-chevron-right text-purple-600 mr-2"></i>NioSctpChannel - SCTP协议</li>
                    </ul>
                </div>
                
                <div class="bg-blue-50 p-6 rounded-lg">
                    <h4 class="font-bold text-blue-800 mb-3">
                        <i class="fas fa-cogs mr-2"></i>核心特性
                    </h4>
                    <ul class="space-y-2 text-gray-700">
                        <li><i